package com.itfitness.cppdemoone.activity

import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.itfitness.cppdemoone.R
import com.itfitness.cppdemoone.databinding.ActivityBoundaryfillBinding

/**
 *
 * @Description:     java类作用描述
 * @Author:         作者名
 * @CreateDate:     2022/2/23 17:01
 * @UpdateUser:     更新者：
 * @UpdateDate:     2022/2/23 17:01
 * @UpdateRemark:   更新说明：
 */
class BoundaryFillActivity:AppCompatActivity(){
    private lateinit var boundaryfillBinding: ActivityBoundaryfillBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        boundaryfillBinding = DataBindingUtil.setContentView(this, R.layout.activity_boundaryfill)
        val bitmapSrc = BitmapFactory.decodeResource(resources,R.drawable.dog)
        //目标图像宽高比源图像要多100（因为目标图像四周都加了50）
        val bitmapDst = Bitmap.createBitmap(bitmapSrc.width + 100 ,bitmapSrc.height + 100 , Bitmap.Config.ARGB_8888)
        boundaryfillBinding.activityBoundaryfillImgDest.setImageBitmap(imageBoundaryFill(bitmapSrc,bitmapDst))
    }



    external fun imageBoundaryFill(bitmapSrc:Bitmap,bitmapDest:Bitmap):Bitmap
}